
import java.util.ArrayList;

import logic.MySQLconnection;
import Entities.RequestEntity;
import fit.ActionFixture;
import gui.AcademicFrame;
import gui.ServerGui;

public class AssessorPairing extends ActionFixture
{
	String reqID;
	String ID;
	String identity = "Aid";
	String status = "2";
	
	ServerGui server;
	AcademicFrame client;
	
	public void setupfixture()
	{
		server = new ServerGui();
		server.fakeServer(5555, "mysql://localhost/test", "root", "Braude");
		server.myLog.setVisible(false);
		client = new AcademicFrame("Localhost",5555);
		
	}

	
	
	public void setRequestID (String requestID)
	{
		reqID = requestID;
	}
	
	public void setAssessorID (String assessorID)
	{
		ID=assessorID;
	}
	  
	public boolean assessorPairing()
	{
		
		
		ArrayList<Object> question = new ArrayList<Object>();
		ArrayList<Object> answer = new ArrayList<Object>();
		
		question.add("Pair");
		question.add(reqID);
		question.add(ID);
		question.add("Aid");
		question.add(status);
		
		client.myclient.sendMessageToServer(question);	
		while (client.answer==null);
		answer = client.answer;
		client.answer=null;
		
		if(answer.get(0).equals("AbleToPair"))
			return true;
		else
			return false;
	}
}
